window.onload = function () {
    var pro = 1;
    var loader = new resLoader({
        resources: [
            'http://res.customer.agoent.com/baojun/images/1-loading_0.png',
            'http://res.customer.agoent.com/baojun/images/animation.gif',
            'http://res.customer.agoent.com/baojun/images/arrow@2x.png',
            'http://res.customer.agoent.com/baojun/images/background_03.png',
            'http://res.customer.agoent.com/baojun/images/background.jpg',
            'http://res.customer.agoent.com/baojun/images/baiyang_03.png',
            'http://res.customer.agoent.com/baojun/images/4_031.png',
            'http://res.customer.agoent.com/baojun/images/determine.png',
            'http://res.customer.agoent.com/baojun/images/bofang.png',
            'http://res.customer.agoent.com/baojun/images/car2@2x.png',
            'http://res.customer.agoent.com/baojun/images/chunv_03.png',
            'http://res.customer.agoent.com/baojun/images/fengexian.png',
            'http://res.customer.agoent.com/baojun/images/forward.png',
            'http://res.customer.agoent.com/baojun/images/prize.png',
            'http://res.customer.agoent.com/baojun/images/shouye.jpg',
            'http://res.customer.agoent.com/baojun/images/H5-4_03.png',
            'http://res.customer.agoent.com/baojun/images/xingzuo.jpg',
            'http://res.customer.agoent.com/baojun/images/images.png',
            'http://res.customer.agoent.com/baojun/images/left.png',
            'http://res.customer.agoent.com/baojun/images/right.png',
            'http://res.customer.agoent.com/baojun/images/jinniu_03.png',
            'http://res.customer.agoent.com/baojun/images/jvxie_03.png',
            'http://res.customer.agoent.com/baojun/images/mojie_03.png',
            'http://res.customer.agoent.com/baojun/images/name.png',
            'http://res.customer.agoent.com/baojun/images/loading.jpg',
            'http://res.customer.agoent.com/baojun/images/liji.png',
            'http://res.customer.agoent.com/baojun/images/sheshou_03.png',
            'http://res.customer.agoent.com/baojun/images/shizi_03.png',
            'http://res.customer.agoent.com/baojun/images/shoucar.png',
            'http://res.customer.agoent.com/baojun/images/shuangyu_03.png',
            'http://res.customer.agoent.com/baojun/images/shuangzi_03.png',
            'http://res.customer.agoent.com/baojun/images/shuiping.png',
            'http://res.customer.agoent.com/baojun/images/tainping_03.png',
            'http://res.customer.agoent.com/baojun/images/tianxie_03.png',
            'http://res.customer.agoent.com/baojun/images/tuoyuan.png',
            'http://res.customer.agoent.com/baojun/images/xian.png',
            'http://res.customer.agoent.com/baojun/images/zanting.png',
            'http://res.customer.agoent.com/baojun/images/choice.png',
            'http://res.customer.agoent.com/baojun/images/share.jpg',
            'http://res.customer.agoent.com/baojun/images/yinyuejie.jpg',
            'http://res.customer.agoent.com/baojun/images/gexingzhuanji.png'
        ],
        onStart: function (total) {
            console.log('index:' + total);
        },
        onProgress: function (current, total) {
            var percent = Math.round(current / total * 100);
            document.querySelector('.pro').innerText = percent;

//          var car_hight = Math.round(260 / total);
//
//          var currentHeight = document.querySelector('.black').offsetHeight;
//          currentHeight = currentHeight.replace('px', '') - car_hight;

//          if (current == total) {
//              $('.black').remove();
//              $('.pro').remove();
//          }

//         document.querySelector('.black').setAttribute('height', currentHeight / 100 + 'rem');
        },
        onComplete: function (total) {
            document.cookie = 'isLoader' + "=" + escape(true) + ";";
            location.href = './index.html#!main'
        }
    });

    loader.start();
};
